import clsx from "clsx";
import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
import HomepageFeatures from "@site/src/components/HomepageFeatures";
import Heading from "@theme/Heading";
import styles from "./index.module.css";
import { download } from "@site/config";

function HomepageHeader() {
  const { siteConfig } = useDocusaurusContext();
  return (
    <header className={clsx("hero hero--primary", styles.heroBanner)}>
      <div className="container">
        <div className={styles.heroContent}>
          <img
            className={styles.heroImage}
            src={require("@site/static/img/ui.png").default}
            alt="我的店铺收银系统操作界面"
          />
          <div className="hero__text">
            <Heading as="h1" className="hero__title">
              我的店铺收银系统
            </Heading>
            <p className="hero__subtitle">{siteConfig.tagline}</p>
            <div className={styles.buttons}>
              <Link
                className="button button--secondary button--lg"
                target="_blank"
                download
                href={download}
              >
                立即下载店铺收银系统（v1.5.3）
              </Link>
            </div>
          </div>
        </div>
      </div>
    </header>
  );
}

export default function Home(): JSX.Element {
  const { siteConfig } = useDocusaurusContext();
  return (
    <Layout
      title={`${siteConfig.title}`}
      description="我的店铺收银系统专为小店打造的收银软件，适用于超市、便利店、餐饮、五金、文具、电商等多种门店场景。"
    >
      <HomepageHeader />
      <main>
        <HomepageFeatures />
      </main>
    </Layout>
  );
}
